package com.example.gray.mapper;

import com.example.gray.entity.OpLog;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author Gray 2021/12/28-18:10
 */
@Mapper
public interface OpLogMapper {
    @Select("select * from op_log")
    public List<OpLog> getAllLog();

    @Select("select * from op_log where userId = #{id}")
    public List<OpLog> getLogById(Integer id);

    @Select("select * from op_log where opDate between #{D1} and #{D2}")
    public List<OpLog> getLogByTime(String D1,String D2);

    @Insert("insert into op_log(ipAddress,userId,opDate,opMethods) values(#{ipAddress},#{userId},#{opDate},#{opMethods})")
    public Integer insertLog(OpLog log);

    @Delete("delete from op_log where logId = #{logId}")
    public Integer deleteLog(Integer logId);

    @Update("update op_log set ipAddress=#{ipAddress},userId=#{userId},opDate=#{opDate},opMethods=#{opMethods} where logId = #{logId}")
    public Integer updateLog(OpLog log);
}
